package com.lzy.cloud.payment.service.impl;

import com.lzy.cloud.payment.dtos.payment.PayRechargeDto;
import com.lzy.cloud.payment.entity.PayRecharge;
import com.lzy.cloud.payment.mapper.PayRechargeMapperExt;
import com.lzy.cloud.payment.service.PayRechargeService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PayRechargeServiceImpl implements PayRechargeService {
    @Autowired
    PayRechargeMapperExt payRechargeMapperExt;

    @Override
    public Boolean insert(PayRechargeDto payRechargeDto) {
        return payRechargeMapperExt.insertSelective(DozerUtils.map(payRechargeDto,PayRecharge.class))>0;
    }

    @Override
    public Boolean updateById(PayRechargeDto payRechargeDto) {
        return payRechargeMapperExt.updateByPrimaryKeySelective(DozerUtils.map(payRechargeDto,PayRecharge.class))>0;
    }

    @Override
    public Boolean updateByOrderId(PayRechargeDto payRechargeDto) {
        return payRechargeMapperExt.updateByOrderId(payRechargeDto)>0;
    }

    @Override
    public Boolean updateByThirdNumber(PayRechargeDto payRechargeDto) {
        return payRechargeMapperExt.updateByThirdNumber(payRechargeDto)>0;
    }

    @Override
    public List<PayRechargeDto> selectList(PayRechargeDto payRechargeDto) {
        return payRechargeMapperExt.selectList(payRechargeDto);
    }

    @Override
    public PayRechargeDto selectById(Long id) {
        return DozerUtils.map(payRechargeMapperExt.selectByPrimaryKey(id),PayRechargeDto.class);
    }

}
